﻿using Survey.Data.DaoEntities;
using Survey.Model.SurveyEntities;

namespace Survey.BLL.SurveyEntities
{
    public class QuestionaryBo : QuestionaryDao
    {
        public QuestionaryBo()
        {
            this.Entity = new Questionary();
        }

        public Questionary CreateCopy(Questionary questionary)
        {
        //    Questionary returnQuestionary = new Questionary();
        //    returnQuestionary.Code = this.Code;
        //    returnQuestionary.Survey = survey;
        //    returnQuestionary.Step = this.Step;
        //    returnQuestionary.IsControl = false;

        //    foreach (Question questionIterator in this.Questions)
        //    {
        //        Question MemberQuestion = questionIterator;
        //        Question question = new Question();
        //        question.IsAnswered = MemberQuestion.IsAnswered;
        //        question.Statement = MemberQuestion.Statement;
        //        question.TypeOfAnswer = MemberQuestion.TypeOfAnswer;

        //        for (int j = 0; j < MemberQuestion.Answers.Count; j++)
        //        {
        //            IAnswer iAnswer = (IAnswer)MemberQuestion.Answers[j];

        //            if (iAnswer.GetAnswerType() == (int)AnswerType.StringType)
        //            {
        //                StringAnswer stringAnswer = new StringAnswer();
        //                stringAnswer.AnswerStatementAfter = MemberQuestion.Answers[j].AnswerStatementAfter;
        //                stringAnswer.AnswerStatementBefore = MemberQuestion.Answers[j].AnswerStatementBefore;
        //                question.Answers.Add(stringAnswer);
        //            }
        //            else if (iAnswer.GetAnswerType() == (int)AnswerType.NumericType)
        //            {
        //                NumericAnswer numericAnswer = new NumericAnswer();
        //                numericAnswer.AnswerStatementAfter = MemberQuestion.Answers[j].AnswerStatementAfter;
        //                numericAnswer.AnswerStatementBefore = MemberQuestion.Answers[j].AnswerStatementBefore;
        //                question.Answers.Add(numericAnswer);
        //            }
        //            else if (iAnswer.GetAnswerType() == (int)AnswerType.AlternativeType)
        //            {
        //                AlternativeAnswer alternativeAnswer = new AlternativeAnswer();
        //                AlternativeAnswer MemberAlternativeAnswer = (AlternativeAnswer)iAnswer;

        //                for (int k = 0; k < MemberAlternativeAnswer.AnswerStatements.Count; k++)
        //                {
        //                    alternativeAnswer.AnswerStatements.Add("");
        //                    alternativeAnswer.AnswerStatements[k] = MemberAlternativeAnswer.AnswerStatements[k];
        //                    alternativeAnswer.checkedAlternatives.Add(new bool());
        //                }

        //                alternativeAnswer.IsMultipleAnswers = MemberAlternativeAnswer.IsMultipleAnswers;
        //                question.Answers.Add(alternativeAnswer);
        //            }
        //        }
        //        returnQuestionary.Questions.Add(question);
        //    }
            return questionary;
        } 
    }
}
